/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cz.uhk.ppro.response.model;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
 *
 *  @author Martin Zmítko <martin.zmitko@gmail.com>
 */

@Entity
@Table(name="TEST")
public class Test extends NamedEntity implements Serializable{

    private String descr;
    private int number;

    @Override
    public String toString() {
        return "{name: \""+getName()+"\"}"; //To change body of generated methods, choose Tools | Templates.
    }

    public Test() {
        
    }
    

    @ManyToMany(mappedBy = "tests", fetch=FetchType.LAZY)
    private List<Course> courses;

    @OneToMany(fetch=FetchType.EAGER, mappedBy="test")
    private List<Question> questions;

    @ManyToOne
    private Types types;

    @OneToOne
    private CompleteTest completeTest;

    public CompleteTest getCompleteTest() {
        return completeTest;
    }

    public void setCompleteTest(CompleteTest completeTest) {
        this.completeTest = completeTest;
    }

    public Types getTypes() {
        return types;
    }

    public void setTypes(Types types) {
        this.types = types;
    }

    public void setQuestions(List<Question> questions)
    {
        this.questions = questions;
    }

    public List<Question> getQuestions() {
        return questions;
    }

    public String getDescr() {
        return descr;
    }

    public void setDescr(String descr) {
        this.descr = descr;
    }

    public List<Course> getCourses() {
        return courses;
    }

    public void setCourse(List<Course> courses) {
        this.courses = courses;
    }

    public int getNumber() {
        return number;
    }

    public void setNumber(int number) {
        this.number = number;
    }

}
